<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/index.xhtml">
        <ui:define name="title"/>
        <ui:define name="body">

            <h:form styleClass="jsfcrud_list_form">
                <p:panel id="panel" header="#{bundle.ListTblPrestamoTitle}" style="margin-bottom:5px;">
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                    <h:outputText escape="false" value="#{bundle.ListTblPrestamoEmpty}" rendered="#{tblPrestamoController.items.rowCount == 0}"/>
                    <h:panelGroup rendered="#{tblPrestamoController.items.rowCount > 0}">

                        <h:commandLink action="#{tblPrestamoController.previous}" value="#{bundle.Previous} #{tblPrestamoController.pagination.pageSize}" rendered="#{tblPrestamoController.pagination.hasPreviousPage}"/>&nbsp;
                        <h:commandLink action="#{tblPrestamoController.next}" value="#{bundle.Next} #{tblPrestamoController.pagination.pageSize}" rendered="#{tblPrestamoController.pagination.hasNextPage}"/>&nbsp;

                        <p:dataTable id="tbl" var="item" value="#{tblPrestamoController.items}" 
                                     paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                                     paginator="true" rows="10" style="margin-bottom:20px; border:solid 1px">

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListTblPrestamoTitle_codPrestamo}"/>
                                </f:facet>
                                <h:outputText value="#{item.codPrestamo}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListTblPrestamoTitle_valorPrestamo}"/>
                                </f:facet>
                                <h:outputText value="#{item.valorPrestamo}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListTblPrestamoTitle_fechaInicioCuota}"/>
                                </f:facet>
                                <h:outputText value="#{item.fechaInicioCuota}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListTblPrestamoTitle_cantidadCuotas}"/>
                                </f:facet>
                                <h:outputText value="#{item.cantidadCuotas}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListTblPrestamoTitle_interes}"/>
                                </f:facet>
                                <h:outputText value="#{item.interes}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListTblPrestamoTitle_interesMora}"/>
                                </f:facet>
                                <h:outputText value="#{item.interesMora}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListTblPrestamoTitle_valorCuota}"/>
                                </f:facet>
                                <h:outputText value="#{item.valorCuota}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListTblPrestamoTitle_periodicidad}"/>
                                </f:facet>
                                <h:outputText value="#{item.periodicidad}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListTblPrestamoTitle_tblNatilleraPersona}"/>
                                </f:facet>
                                <h:outputText value="#{item.tblNatilleraPersona}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListTblPrestamoTitle_estado}"/>
                                </f:facet>
                                <h:outputText value="#{item.estado}"/>
                            </p:column>
                            
                            <p:column>
                                <p:growl id="messages" /> 
                                <p:splitButton value="#{bundle.ListTblPrestamoViewLink}" action="#{tblPrestamoController.prepareView}" update="messages" icon="ui-icon-disk"> 
                                    <p:menuitem value="#{bundle.ListTblPrestamoEditLink}" action="#{tblPrestamoController.prepareEdit}" ajax="false" icon="ui-icon-close" />
                                    <p:menuitem value="#{bundle.ListTblPrestamoDestroyLink}" action="#{tblPrestamoController.destroy}" ajax="false" icon="ui-icon-close" />
                                </p:splitButton>
                            </p:column>

                        </p:dataTable>
                        <h:outputText value="Pag. #{tblPrestamoController.pagination.pageFirstItem + 1} de #{tblPrestamoController.pagination.pageLastItem + 1}/#{tblPrestamoController.pagination.itemsCount}"/>&nbsp;
                    </h:panelGroup>
                    <br />
                    <p:commandButton action="#{tblPrestamoController.prepareCreate}" value="#{bundle.ListTblPrestamoCreateLink}"/>
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
